/**
 * 研发工具API
 *
 * @版权所有 rem.studio
 */
import { stringify } from 'qs';
import request from '@/utils/request';

/** 研发工具API开始 */

export async function queryGenerator(params = {}) {
  return request(`/api/generator/generator/queryGenerator?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function queryFieldByGeneratorId(params = {}) {
  return request(`/api/generator/generator/queryFieldByGeneratorId?${stringify(params)}`, {
    method: 'GET'
  });
}

export async function deleteGenerator(params) {
  return request('/api/generator/generator/deleteGenerator', {
    method: 'POST',
    requestType: 'form',
    data: {
      ...params
    }
  });
}

export async function addGenerator(params) {
  return request('/api/generator/generator/addGenerator', {
    method: 'POST',
    data: {
      ...params
    }
  });
}

export async function updateGenerator(params) {
  return request('/api/generator/generator/updateGenerator', {
    method: 'PUT',
    data: {
      ...params.body
    }
  });
}

export async function exportGenerator(params) {
  return request('/api/generator/generator/exportGenerator', {
    method: 'POST',
    requestType: 'form',
    responseType: 'blob',
    data: {
      ...params
    }
  });
}

export async function generateResource(params) {
  return request('/api/generator/generator/generateResource', {
    method: 'POST',
    requestType: 'form',
    responseType: 'blob',
    data: {
      ...params
    }
  });
}

/** 研发工具API结束 */
